package com.web.config;


import java.io.IOException;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Controller;

import org.springframework.web.multipart.commons.CommonsMultipartResolver;





/**
 * 
 * ClassName: AppConfig <br/>
 * Description: <应用配置类> Function:
 * 负责注册除Controller等web层以外的所有bean，包括aop代理，service层，dao层，缓存，等等 Reason: TODO ADD
 * REASON(可选). <br/>
 * date: 2017-8-10 下午4:36:03 <br/>
 *
 * @author Sunxq
 * @version
 * @since JDK 1.8
 */
@Configuration
@Import({DBConfig.class})
@ComponentScan(basePackages = "com.jywl", excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = { Controller.class }) })

public class AppConfig {  
	@Bean(name="multipartResolver")   
    public CommonsMultipartResolver getResolver() throws IOException{  
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();  
        // resolver.setMaxUploadSizePerFile(Long.valueOf(PropertiesHelper.get("file.MaxUploadSizePerFile")));//5MB  
       // resolver.setMaxUploadSizePerFile(10000000);//5MB
        resolver.setResolveLazily(true);
       
        return resolver;  
    } 
	
}
